<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../print.css" type="text/css" media="print">
<meta content="DataGrid2CSV,com.iwobanas.controls.DataGrid2CSV,columnSeparator,includeHeader,rowSeparator,target,useRawData,escapeValue,getCSV,getDataRow,getDataRows,getFieldValue,getHeadrRow" name="keywords">
<title>com.iwobanas.controls.DataGrid2CSV</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'DataGrid2CSV - ReusableFx components documentation';
				var baseRef = '../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">ReusableFx components documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../index-list.html')" href="../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../index.html?com/iwobanas/controls/DataGrid2CSV.html&amp;com/iwobanas/controls/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;DataGrid2CSV</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class DataGrid2CSV"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.iwobanas.controls</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class DataGrid2CSV</td>
</tr>
</table>
<p></p>
  The DataGrid2CSV defines utility class to export data displayed in DataGrid to CSV format.
  
  <p>Note that DataGrid2CSV does not handle saving CSV file to filesystem or transmitting it over network,
  all what DataGrid2CSV does is returning String containing data in SCV format which then may 
  be saved or transmitted by application code.</p>
  <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#columnSeparator">columnSeparator</a> : String = ","<div class="summaryTableDescription">
   String used to separate columns in exported data.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#includeHeader">includeHeader</a> : Boolean = true<div class="summaryTableDescription">
   Flag indicating if header row should be added at the top of CSV document.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#rowSeparator">rowSeparator</a> : String = "
"<div class="summaryTableDescription">
   String used to separate rows in exported data.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#target">target</a> : DataGrid<div class="summaryTableDescription">
   Target DataGrid from which data should be exported.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#useRawData">useRawData</a> : Boolean = false<div class="summaryTableDescription">
   Flag indicating if raw data should be used when possible.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getCSV()">getCSV</a>():String</div>
<div class="summaryTableDescription">
   Get the data from DataGrid formatted as CSV.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
</table>
</div>
<a name="protectedMethodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Protected Methods</div>
<table id="summaryTableProtectedMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#escapeValue()">escapeValue</a>(value:String):String</div>
<div class="summaryTableDescription">
   Escape passed value so that it can be used as CSV field.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getDataRow()">getDataRow</a>(item:Object):String</div>
<div class="summaryTableDescription">
   Get data row in CSV format for a given DataGrid item.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getDataRows()">getDataRows</a>():String</div>
<div class="summaryTableDescription">
   Get all data rows in CSV format.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getFieldValue()">getFieldValue</a>(item:Object, column:DataGridColumn):String</div>
<div class="summaryTableDescription">
   Get the String value for a given DataGrid item and column.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getHeadrRow()">getHeadrRow</a>():String</div>
<div class="summaryTableDescription">
   Get header row in CSV format.</div>
</td><td class="summaryTableOwnerCol">DataGrid2CSV</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="columnSeparator"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">columnSeparator</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>public var columnSeparator:String = ","</code><p>
   String used to separate columns in exported data.
   According to RFC 4180 this should be comma.
   Column separator is not added after last column in row.
   </p><p>This property can be used as the source for data binding.</p>
</div>
<a name="includeHeader"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">includeHeader</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var includeHeader:Boolean = true</code><p>
   Flag indicating if header row should be added at the top of CSV document.
   </p><p>This property can be used as the source for data binding.</p>
</div>
<a name="rowSeparator"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">rowSeparator</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var rowSeparator:String = "
"</code><p>
   String used to separate rows in exported data.
   According to RFC 4180 this should be CRLF.
   </p><p>This property can be used as the source for data binding.</p>
</div>
<a name="target"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">target</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var target:DataGrid</code><p>
   Target DataGrid from which data should be exported.
   This may also be subclass of DataGrid for example MDataGrid.
   </p><p>This property can be used as the source for data binding.</p>
</div>
<a name="useRawData"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">useRawData</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var useRawData:Boolean = false</code><p>
   Flag indicating if raw data should be used when possible.
   
   If <code>true</code> label functions will not be used for columns 
   with <code>dataField</code> defined i.e. standard <code>toString()</code> 
   function will be used.
   
   If <code>false</code> label functions will be used for all columns
   with label function defined.
   </p><p>This property can be used as the source for data binding.</p>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="escapeValue()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">escapeValue</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>protected function escapeValue(value:String):String</code><p>
   Escape passed value so that it can be used as CSV field.
   By default all fields are surrounded with double quotes 
   and double quotes inside field are escaped by adding 
   double quotes (see RFC 4180).
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">value</span>:String</code> &mdash; value which should be escaped
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash; escaped value
   </td>
</tr>
</table>
</div>
<a name="getCSV()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getCSV</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function getCSV():String</code><p>
   Get the data from DataGrid formatted as CSV.
   All parameters including <code>target</code> have to be set before call to this function.
   
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash; DataGrid formatted as CSV or empty String if <code>target</code> is not set.
   </td>
</tr>
</table>
</div>
<a name="getDataRow()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getDataRow</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>protected function getDataRow(item:Object):String</code><p>
   Get data row in CSV format for a given DataGrid item.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">item</span>:Object</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash; data row in CSV format
   </td>
</tr>
</table>
</div>
<a name="getDataRows()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getDataRows</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>protected function getDataRows():String</code><p>
   Get all data rows in CSV format.
   This function iterates over DataGrid data provider and calls <code>getDataRow()</code>.
   
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash; all data rows in CSV format
   </td>
</tr>
</table>
</div>
<a name="getFieldValue()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getFieldValue</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>protected function getFieldValue(item:Object, column:DataGridColumn):String</code><p>
   Get the String value for a given DataGrid item and column.
   Depending on <code>useRawData</code> flag this may be label
   created using label function or raw data converted to String.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">item</span>:Object</code> &mdash; DataGrid item for which value should be returned
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">column</span>:DataGridColumn</code> &mdash; DataGrid column for which value should be returned
   
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash; value for a given DataGrid item and column
   </td>
</tr>
</table>
</div>
<a name="getHeadrRow()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getHeadrRow</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>protected function getHeadrRow():String</code><p>
   Get header row in CSV format.
   
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash; header row in CSV format
   </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">&copy; 2009 Iwo Banaś - http://www.iwobanas.com</center>
</div>
</body>
</html>
<!--© 2009 Iwo Banaś - http://www.iwobanas.com-->
